package  htmlAnalyze
{
	import htmlAnalyze.htmlObject.*
	/**
	 * ...
	 * @author FireKnight
	 */
	public class MakeHtmlArray 
	{
		
		public function MakeHtmlArray() 
		{
			
		}
		
		public static function makeArray(s:Array, b:Object):Array
		{
			if (b.length==null || b.length==undefined) 
			{
				trace("this is not a array!");
				return [b];
			}
			for (var i:uint = 0; i < b.length; i++)
			{
				
				var element;
				if (b[i].nodeName == "DIV")
				{
					element = new HTMLDivElement(b[i]);
					s.push(element);
				}
				else if (b[i].nodeName == "#text")
				{
					element = new HtmlTextElement(b[i]);
					s.push(element);
				}
				else if (b[i].nodeName == "P")
				{
					element = new HTMLParagraphElement(b[i]);
					s.push(element);
				}
				else if (b[i].nodeName == "IMG")
				{
					element = new HTMLImageElement(b[i]);
					s.push(element);
				}
				else
				{
					s.push(b[i]);
				}
				
			}
			return s;
		}
		
	}

}